System and method for reclaiming unused space from a thinly provisioned data container

ABSTRACT

A system and method for reclaims unused space from a thinly provision data container served by a storage system. A host-side agent detects blocks of the data container that may be freed and sends a novel Punch Hole command to the storage system associated with the data container. The storage system allocates the appropriate blocks in response to the Punch Hole command.

FIELD OF THE INVENTION

The present invention relates to storage systems and, in particular, toreclaiming unused space from a thinly provisioned data container on astorage system.

BACKGROUND OF THE INVENTION

A storage system is a computer that provides storage service relating tothe organization of information on writable persistent storage devices,such as memories, tapes or disks. The storage system is commonlydeployed within a storage area network (SAN) or a network attachedstorage (NAS) environment. When used within a NAS environment, thestorage system may be embodied as a file server including an operatingsystem that implements a file system to logically organize theinformation as a hierarchical structure of directories and files on,e.g. the disks. Each “on-disk” file may be implemented as a set of datastructures, e.g., disk blocks, configured to store information, such asthe actual data for the file. A directory, on the other hand, may beimplemented as a specially formatted file in which information aboutother files and directories are stored. As used herein a file is definedto be any logical storage container that contains a fixed or variableamount of data storage space, and that may be allocated storage out of alarger pool of available data storage space. As such, the term file, asused herein and unless the context otherwise dictates, can also mean acontainer, object or any other storage entity that does not corresponddirectly to a set of fixed data storage devices. A file system is,generally, a computer system for managing such files, including theallocation of fixed storage space to store files on a temporary orpermanent basis.

The storage system may be further configured to operate according to aclient/server model of information delivery to thereby allow many clientsystems (clients) to access shared resources, such as files, stored onthe storage system. Sharing of files is a hallmark of a NAS system,which is enabled because of its semantic level of access to files andfile systems. Storage of information on a NAS system is typicallydeployed over a computer network comprising a geographically distributedcollection of interconnected communication links, such as Ethernet, thatallow clients to remotely access the information (files) on the filer.The clients typically communicate with the storage system by exchangingdiscrete frames or packets of data according to pre-defined protocols,such as the Transmission Control Protocol/Internet Protocol (TCP/IP).

In the client/server model, the client may comprise an applicationexecuting on a computer that “connects” to the storage system over acomputer network, such as a point-to-point link, shared local areanetwork, wide area network or virtual private network implemented over apublic network, such as the Internet. NAS systems generally utilizefile-based access protocols; therefore, each client may request theservices of the storage system by issuing file system protocol messages(in the form of packets) to the file system over the network identifyingone or more files to be accessed without regard to specific locations,e.g., blocks, in which the data are stored on disk. By supporting aplurality of file system protocols, such as the conventional CommonInternet File System (CIFS), the Network File System (NFS) and theDirect Access File System (DAFS) protocols, the utility of the storagesystem may be enhanced for networking clients.

A SAN is a high-speed network that enables establishment of directconnections between a storage system and its storage devices. The SANmay thus be viewed as an extension to a storage bus and, as such, anoperating system of the storage system enables access to storedinformation using block-based access protocols over the “extended bus”.In this context, the extended bus is typically embodied as Fibre Channel(FC) or Ethernet media adapted to operate with block access protocols,such as Small Computer Systems Interface (SCSI) protocol encapsulationover FC or TCP/IP/Ethernet.

A SAN arrangement or deployment allows decoupling of storage from thestorage system, such as an application server, and some level ofinformation storage sharing at the application server level. There are,however, environments wherein a SAN is dedicated to a single server. Insome SAN deployments, the information is organized in the form ofdatabases, while in others a file-based organization is employed. Wherethe information is organized as files, the client requesting theinformation maintains file mappings and manages file semantics, whileits requests (and server responses) address the information in terms ofblock addressing on disk using, e.g., a logical unit number (LUN).

In some SAN environments, storage systems may export virtual disks(vdisks) to clients utilizing block-based protocols, such as, forexample, Fibre Channel and iSCSI. One example of a vdisk is a specialfile type in a volume that derives from a plain file, but that hasassociated export controls and operation restrictions that supportemulation of a disk. Vdisks are described further in U.S. patentapplication Ser. No. 10/216,453, entitled STORAGE VIRTUALIZATION BYLAYERING VIRTUAL DISK OBJECTS ON A FILE SYSTEM, by Vijayan Rajan, etal., the contents of which are hereby incorporated by reference. Theseblock-based protocols and the exported file/vdisks appear as physicaldisk devices to the clients of the storage system.

Certain file systems, including the exemplary write anywhere file layout(WAFL) file system available from Network Appliance, Inc, of Sunnyvale,Calif., include the capability to generate a thinly provisioned datacontainer, wherein the data container is not completely written to diskat the time of its creation. As used herein, the term data containergenerally refers to a unit of storage for holding data, such as a filesystem, disk file, volume or a logical number (LUN), which isaddressable by, e.g., its own unique identification. The storage spacerequired to hold the data contents of the thinly provisioned datacontainer on disk has not yet been used. The use of thinly provisioneddata container is often utilized in the exemplary WAFL file systemenvironment when, for example, a vdisk is initially generated. A user oradministrator may generate a vdisk of specified size, for example, 10gigabytes (GB). This size represents the maximum addressable space ofthe vdisk. To increase system performance, the file system generallydoes not write the entire vdisk to the disks at the time of creation.Instead, the file system generates a thinly provisioned data container(i.e., file) representing the vdisk. The thinly provisioned datacontainer may then be populated (filled in) via subsequent writeoperations as the vdisk is filled in with data. While this descriptionis written in terms of a thinly provisioned data container over andunderlying file system, it should be noted that other thin provisioningimplementations may be utilized. As such, the use of an underlying filesystem to support a thinly provisioned data container should be taken asexemplary only.

FIG. 1 is a schematic block diagram of an (inode structure) buffer tree100 of an exemplary thinly provisioned data container. This (inode)buffer tree structure 100 is created when, for example, a vdisk is firstcreated by the file system as thinly provisioned. In a typical thinlyprovisioned data container, only the inode 105 is actually written todisk. The remainder of the data container is not written to or otherwisephysically stored on the disks storing the data container. The datacontainer 100 includes a completed inode 105, however, it does notcontain indirect blocks 110, 120 or file data blocks 125 (as shown inphantom). Thus, these phantom blocks (i.e., 110, 120, 125) are notgenerated when the data container is created, although, they will bewritten to disk as the data container is populated. By only writing theinode to disk when a thinly provisioned data container is generated,substantial time is saved as the number of disk accesses is reduced.Additionally, only the storage space on the disks that is needed to holdthe contents of the data container are utilized. Illustratively, thefile system will make appropriate space reservations to ensure that theentire thinly provisioned data container may be written to disk. Spacereservation techniques are described in U.S. patent application Ser. No.10/423,391, entitled SYSTEM AND METHOD FOR RESERVING SPACE TO GUARANTEEFILE WRITABILITY IN A FILE SYSTEM SUPPORTING PERSISTENT CONSISTENCYPOINT IMAGES, by Peter F. Corbett, et al.

FIG. 2 is a schematic block diagram of an exemplary (inode) buffer treestructure 200 of a partially filled in thinly provisioned data containerthat includes original inode 105. Here, indirect blocks 210, 220 andexemplary file data block 225 have been populated (filled in) inresponse to one or more write operations to the data container.Continued write operations will result in filling in additional datablocks, for example, file data block 325 as shown in the exemplary(inode) buffer tree structure 300 of FIG. 3. Eventually, when the datacontainer has been completely filled, all blocks, including such blocksas indirect blocks 420 and associated file data blocks (not shown) willbe completed as illustrated in the schematic block diagram of anexemplary inode structure 400 in FIG. 4. At such time, the thinlyprovisioned data container has been completely filled in and each blockis associated with an actual block on disk.

A known environment for utilizing a storage system with a thinlyprovisioned data container, i.e., a thinly provisioned LUN, involvesoverlaying a host-side file system onto the thinly provisioned LUN. Insuch an environment, the host (or client of the storage system) includesa file system that utilizes the exported LUN as storage and maintainsstructured storage, e.g., a file system, on the blocks of the LUN.However, a noted disadvantage is that the host-side file system does notcommunicate status to the storage system concerning the deletion ordeallocation of blocks within the LUN. Although the file systemtypically records appropriate metadata entries when a file is deleted,no status message is passed to the storage system that notifies thesystem that certain blocks of the LUN are no longer in use. Thus, whilethe LUN may dynamically grow by allocating additional blocks (up to itsmaximum number of addressable blocks) as needed, it will not deallocateblocks as files are deleted in the host-side file system. For example,if a LUN is generated with a maximum size of 100 GB and then a 50 GBfile is written to it, the LUN will allocate 50 GB of space on thestorage system. If the 50 GB file is thereafter deleted in the host-sidefile system, that file system records appropriate metadata entries andfrees its file system pointers. However, the LUN will still occupy 50 GBof space on the storage system, even though the 50 GB is now unusedspace within the LUN.

SUMMARY OF THE INVENTION

The disadvantages of the prior art are overcome by providing a systemand method for reclaiming unused storage space from a thinly provisioneddata container, such as a logical unit number (LUN) of a storage system.A host-side agent executes on a client (host) of the storage system. Thehost-side agent detects which blocks have been freed from a host-sidefile system and sends a novel Punch Hole command to the storage system,which causes the storage system to deallocate certain ranges of blockswithin the data container, thereby permitting the data container toshrink in size. The agent sends the Punch Hole command to the storagesystem via a conventional data pathway between the client and thestorage system, e.g., as a vendor-specific SCSI command over a FCPconnection.

In an alternate embodiment, the agent iteratively allocates a file onthe host-side file system, locks the file and determines which blocks ofthe underlying data container on the storage system are supporting thelocked file. The agent then sends the novel Punch Hole command to thestorage system to deallocate the blocks associated with the locked file.By repeatedly performing this process and ensuring that the files arestored on differing blocks of the data container, the agent may ensurethat all unused blocks of data container are freed.

Additionally, the agent may interface with a host-side application thatdoes not implement a file system but utilizes some other form ofstructured storage, such as a database program. In such an embodiment,the agent queries the application to determine the nature of thestructured storage utilized by the application and then sends one ormore appropriate Punch Hole commands to the storage system to deallocateany unused blocks of the data container.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and further advantages of the invention may be betterunderstood by referring to the following description in conjunction withthe accompanying drawings in which like reference numerals indicateidentical or functionally similar elements:

FIG. 1, already described, is a schematic block diagram of an exemplarythinly provisioned data container showing a inode for the datacontainer;

FIG. 2, already described, is a schematic block diagram of a partiallyfilled in thinly provisioned data container in accordance with anembodiment of the present invention;

FIG. 3 is a schematic block diagram of a an exemplary partially filledin thinly provisioned data container in accordance with an embodiment ofthe present invention;

FIG. 4, already described, is a schematic block diagram of an exemplaryfilled in data container in accordance with an embodiment of the presentinvention;

FIG. 5 is a schematic block diagram of an exemplary storage system inaccordance with an embodiment of the present invention;

FIG. 6 is a schematic block diagram of an exemplary storage operatingsystem for use with the storage system of FIG. 5 in accordance with anembodiment of the present invention;

FIG. 7A is a schematic block diagram of the format of an exemplary PunchHole command structure in accordance with an embodiment of the presentinvention;

FIG. 7B is a schematic block diagram of the format of an exemplary PunchHole command structure in accordance with an embodiment of the presentinvention;

FIG. 8 is a flowchart detailing the steps of a procedure for reclaimingunused space in a thinly provisioned data container in accordance withan embodiment of the present invention; and

FIG. 9 is a flowchart detailing the steps of a procedure for reclaimingunused space in a thinly provisioned data container in accordance withan embodiment of the present invention.

DETAILED DESCRIPTION OF AN ILLUSTRATIVE EMBODIMENT

A. Storage Appliance

The present invention may be implemented, in the illustrativeembodiment, on a storage appliance that serves both file and blockprotocol access to information stored on storage devices in anintegrated manner. In this context, the term storage appliance denotes acomputer having features such as simplicity of storage servicemanagement and ease of storage reconfiguration, including reusablestorage space, for users (system administrators) and clients of networkattached storage (NAS) and storage area network (SAN) deployments. Thestorage appliance may provide NAS services through a file system, whilethe same appliance provides SAN services through SAN virtualization,including logical unit number (LUN) emulation. While this description iswritten in terms of storage appliances, the principles of the presentinvention may be applied to any storage system. As such the use ofstorage appliances should be taken as exemplary only.

FIG. 5 is a schematic block diagram of a storage appliance 500configured to provide storage service relating to the organization ofinformation on storage devices, such as disks 530. The storage appliance500 is illustratively embodied as a storage system comprising aprocessor 522, a memory 524, a plurality of network adapters 525, 526and a storage adapter 528 interconnected by a system bus 523. Themulti-protocol storage appliance 500 also includes a storage operatingsystem 600 that provides a virtualization system (and, in particular, afile system) to logically organize the information as a hierarchicalstructure of named directory, file and virtual disk (vdisk) storageobjects on the disks 530.

Whereas clients of a NAS-based network environment have a storageviewpoint of files, the clients of a SAN-based network environment havea storage viewpoint of blocks or disks. To that end, the storageappliance 500 presents (exports) disks to SAN clients through thecreation of logical unit numbers (LUNs) or vdisk objects. A vdisk object(hereinafter “vdisk”) is a special file type that is implemented by thevirtualization system and translated into an emulated disk as viewed bythe SAN clients. The storage appliance thereafter makes these vdisksaccessible to the SAN clients through controlled exports, as describedfurther herein.

In the illustrative embodiment, the memory 524 comprises storagelocations that are addressable by the processor and adapters for storingsoftware program code and data structures associated with the presentinvention. The processor and adapters may, in turn, comprise processingelements and/or logic circuitry configured to execute the software codeand manipulate the data structures. The storage operating system 600,portions of which are typically resident in memory and executed by theprocessing elements, functionally organizes the storage appliance by,inter alia, invoking storage operations in support of the storageservice implemented by the appliance. It will be apparent to thoseskilled in the art that other processing and memory means, includingvarious computer readable media, may be used for storing and executingprogram instructions pertaining to the inventive system and methoddescribed herein.

The network adapter 525 couples the storage appliance to a plurality ofclients 560 a,b over point-to-point links, wide area networks, virtualprivate networks implemented over a public network (Internet) or ashared local area network, hereinafter referred to as an illustrativeEthernet network 565. Therefore, the network adapter 525 may comprise anetwork interface card (NIC) having the mechanical, electrical andsignaling circuitry needed to connect the appliance to a network switch,such as a conventional Ethernet switch 570. For this NAS-based networkenvironment, the clients are configured to access information stored onthe multi-protocol appliance as files. The clients 560 communicate withthe storage appliance over network 565 by exchanging discrete frames orpackets of data according to pre-defined protocols, such as theTransmission Control Protocol/Internet Protocol (TCP/IP).

The clients 560 may be general-purpose computers configured to executeapplications over a variety of operating systems, including the UNIX®and Microsoft® Windows™ operating systems. Client systems generallyutilize file-based access protocols when accessing information (in theform of files and directories) over a NAS-based network. Therefore, eachclient 560 may request the services of the storage appliance 500 byissuing file access protocol messages (in the form of packets) to theappliance over the network 565. It will be apparent to those skilled inthe art that other clients running other types of operating systems mayalso communicate with the integrated multi-protocol storage applianceusing other file access protocols.

Illustratively, client (or host) 560 b includes a file system 590 thatinterfaces with one or more applications 592. The host-side file system590 illustratively implements a file system overlaid onto a datacontainer serviced by the storage system. For example, the storagesystem may export a LUN, which the host-side file system 590 utilizes tostore data. In an illustrative embodiment, a novel host-side agent 594also executes on client 560 b. According to the invention, the agent 594blocks of a thinly provisioned data container may be reclaimed and bysending a novel Punch Hole command to the storage system, as describedfurther below. Alternately, a non-file system application 596 executingon client 560 a, which application 596 may comprise a database system orother system. In accordance with an alternate embodiment of the presentinvention, the novel agent 594 may also execute on client 560 a

The storage network “target” adapter 526 also couples the multi-protocolstorage appliance 500 to clients 560 that may be further configured toaccess the stored information as blocks or disks. For this SAN-basednetwork environment, the storage appliance is coupled to an illustrativeFibre Channel (FC) network 585. FC is a networking standard describing asuite of protocols and media that is primarily found in SAN deployments.The network target adapter 526 may comprise a FC host bus adapter (HBA)having the mechanical, electrical and signaling circuitry needed toconnect the appliance 100 to a SAN network switch, such as aconventional FC switch 580. In addition to providing FC access, the FCHBA may offload Fibre Channel network processing operations for thestorage appliance.

The clients 560 generally utilize block-based access protocols, such asthe Small Computer Systems Interface (SCSI) protocol, when accessinginformation (in the form of blocks, disks or vdisks) over a SAN-basednetwork. SCSI is a peripheral input/output (I/O) interface with astandard, device independent protocol that allows different peripheraldevices, such as disks 530, to attach to the storage appliance 500. InSCSI terminology, clients 560 operating in a SAN environment areinitiators that initiate requests and commands for data. Themulti-protocol storage appliance is thus a target configured to respondto the requests issued by the initiators in accordance with arequest/response protocol. The initiators and targets have endpointaddresses that, in accordance with the FC protocol, comprise worldwidenames (WWN). A WWN is a unique identifier, e.g., a node name or a portname, consisting of an 8-byte number.

The storage appliance 500 supports various SCSI-based protocols used inSAN deployments, including SCSI encapsulated over TCP (iSCSI) and SCSIencapsulated over FC (FCP). The initiators (hereinafter clients 560) maythus request the services of the target (hereinafter storage appliance500) by issuing iSCSI and FCP messages over the network 565, 585 toaccess information stored on the disks. It will be apparent to thoseskilled in the art that the clients may also request the services of theintegrated multi-protocol storage appliance using other block accessprotocols. By supporting a plurality of block access protocols, themulti-protocol storage appliance provides a unified and coherent accesssolution to vdisks/LUNs in a heterogeneous SAN environment.

The storage adapter 528 cooperates with the storage operating system 600executing on the storage appliance to access information requested bythe clients. The information may be stored on the disks 530 or othersimilar media adapted to store information. The storage adapter includesI/O interface circuitry that couples to the disks over an I/Ointerconnect arrangement, such as a conventional high-performance, FCserial link topology. The information is retrieved by the storageadapter and, if necessary, processed by the processor 522 (or theadapter 528 itself) prior to being forwarded over the system bus 523 tothe network adapters 525, 526, where the information is formatted intopackets or messages and returned to the clients.

Storage of information on the appliance 500 is preferably implemented asone or more storage volumes (e.g., VOL1-2 550) that comprise a clusterof physical storage disks 530, defining an overall logical arrangementof disk space. The disks within a volume are typically organized as oneor more groups of Redundant Array of Independent (or Inexpensive) Disks(RAID). RAID implementations enhance the reliability/integrity of datastorage through the writing of data “stripes” across a given number ofphysical disks in the RAID group, and the appropriate storing ofredundant information with respect to the striped data. The redundantinformation enables recovery of data lost when a storage device fails.It will be apparent to those skilled in the art that other redundancytechniques, such as mirroring, may be used in accordance with thepresent invention.

Specifically, each volume 550 is constructed from an array of physicaldisks 530 that are organized as RAID groups 540, 542, and 544. Thephysical disks of each RAID group include those disks configured tostore striped data (D) and those configured to store parity (P) for thedata, in accordance with an illustrative RAID 4 level configuration. Itshould be noted that other RAID level configurations (e.g. RAID 5) arealso contemplated for use with the teachings described herein. In theillustrative embodiment, a minimum of one parity disk and one data diskmay be employed.

B. Storage Operating System

To facilitate access to the disks 530, the storage operating system 600implements a write-anywhere file system of a virtualization system that“virtualizes” the storage space provided by disks 530. The file systemlogically organizes the information as a hierarchical structure of nameddirectory and file objects (hereinafter “directories” and “files”) onthe disks. Each “on-disk” file may be implemented as set of disk blocksconfigured to store information, such as data, whereas the directory maybe implemented as a specially formatted file in which names and links toother files and directories are stored. The virtualization system allowsthe file system to further logically organize information as ahierarchical structure of named vdisks on the disks, thereby providingan integrated NAS and SAN appliance approach to storage by enablingfile-based (NAS) access to the named files and directories, whilefurther enabling block-based (SAN) access to the named vdisks on afile-based storage platform. The file system simplifies the complexityof management of the underlying physical storage in SAN deployments.

As noted, a vdisk is a special file type in a volume that derives from aplain (regular) file, but that has associated export controls andoperation restrictions that support emulation of a disk. Unlike a filethat can be created by a client using, e.g., the NFS or CIFS protocol, avdisk is created on the storage appliance via, e.g. a user interface(UI) as a special typed file (object). Illustratively, the vdisk is amulti-inode object comprising a special file inode that holds data andat least one associated stream inode that holds attributes, includingsecurity information. The special file inode functions as a maincontainer for storing data, such as application data, associated withthe emulated disk. The stream inode stores attributes that allow LUNsand exports to persist over, e.g., reboot operations, while alsoenabling management of the vdisk as a single disk object in relation toSAN clients. An example of a vdisk and its associated inodes that may beadvantageously used with the present invention is described in U.S.patent application Ser. No. 10/216,453, entitled STORAGE VIRTUALIZATIONBY LAYERING VDISKS ON A FILE SYSTEM, by which application is herebyincorporated by reference as though fully set forth herein.

In accordance with an illustrative embodiment of the present invention,when a vdisk is generated it is typically created as a thinlyprovisioned data container. However, the storage operating system willalso reserve the appropriate amount of storage space to fill the “holes”of the newly generated vdisk. This space reservation technique ensuresthat there is sufficient space on the disks to completely fill in thedata container. Exemplary space reservation policies and techniques arefurther described in U.S. patent application Ser. No. 10/423,391,entitled SYSTEM AND METHOD FOR RESERVING SPACE TO GURANTEE FILEWRITABILITY IN A FILE SYSTEM SUPPORTING PERSISITENT CONSISTENCY POINTIMAGES, by Peter F. Corbett, et al.

In the illustrative embodiment, the storage operating system ispreferably the NetApp® Data ONTAP™ operating system available fromNetwork Appliance, Inc., Sunnyvale, Calif. that implements a WriteAnywhere File Layout (WAFL™) file system. However, it is expresslycontemplated that any appropriate storage operating system, including awrite in-place file system, may be enhanced for use in accordance withthe inventive principles described herein. As such, where the term“WAFL” is employed, it should be taken broadly to refer to any filesystem that is otherwise adaptable to the teachings of this invention.

As used herein, the term “storage operating system” generally refers tothe computer-executable code operable on a computer that manages dataaccess and may, in the case of a multi-protocol storage appliance,implement data access semantics, such as the Data ONTAP storageoperating system, which is implemented as a microkernel. The storageoperating system can also be implemented as an application programoperating over a general-purpose operating system, such as UNIX® orWindows NT®, or as a general-purpose operating system with configurablefunctionality, which is configured for storage applications as describedherein.

In addition, it will be understood to those skilled in the art that theinventive system and method described herein may apply to any type ofspecial-purpose (e.g., storage serving appliance) or general-purposecomputer, including a standalone computer or portion thereof, embodiedas or including a storage system. Moreover, the teachings of thisinvention can be adapted to a variety of storage system architecturesincluding, but not limited to, a network-attached storage environment, astorage area network and disk assembly directly-attached to a client orhost computer. The term “storage system” should therefore be takenbroadly to include such arrangements in addition to any subsystemsconfigured to perform a storage function and associated with otherequipment or systems.

FIG. 6 is a schematic block diagram of an exemplary storage operatingsystem 600 that may be advantageously used with the present invention.The storage operating system comprises a series of software layersorganized to form an integrated network protocol stack or, moregenerally, a multi-protocol engine that provides data paths for clientsto access information stored on the multi-protocol storage applianceusing block and file access protocols. The protocol stack includes amedia access layer 610 of network drivers (e.g., gigabit Ethernetdrivers) that interfaces to network protocol layers, such as the IPlayer 612 and its supporting transport mechanisms, the TCP layer 614 andthe User Datagram Protocol (UDP) layer 616. A file system protocol layerprovides multi-protocol file access and, to that end, includes supportfor the DAFS protocol 618, the NFS protocol 620, the CIFS protocol 622and the Hypertext Transfer Protocol (HTTP) protocol 624. A VirtualInterface (VI) layer 626 implements the VI architecture to providedirect access transport (DAT) capabilities, such as RDMA, as required bythe DAFS protocol 618.

An iSCSI driver layer 628 provides block protocol access over the TCP/IPnetwork protocol layers, while a FC driver layer 630 operates with theFC HBA 526 to receive and transmit block access requests and responsesto and from the integrated storage appliance. The FC and iSCSI driversprovide FC-specific and iSCSI-specific access control to the LUNs(vdisks) and, thus, manage exports of vdisks to either iSCSI or FCP or,alternatively, to both iSCSI and FCP when accessing a single vdisk onthe multi-protocol storage appliance. In addition, the storage operatingsystem includes a disk storage layer 640 that implements a disk storageprotocol, such as a RAID protocol, and a disk driver layer 650 thatimplements a disk access protocol such as, e.g., a SCSI protocol.

Bridging the disk software layers with the integrated network protocolstack layers is a virtualization system 655 that is implemented by afile system 665 cooperating with virtualization modules illustrativelyembodied as, e.g., vdisk module 670 and SCSI target module 660. Itshould be noted that the vdisk module 670, file system 665 and SCSItarget module 660 can be implemented in software, hardware, firmware, ora combination thereof. The vdisk module 670 is layered on (and interactswith) the file system 665 to provide a data path from the block-basedSCSI target module to blocks managed by the file system. In essence, thevdisk module 670 manages SAN deployments by, among other things,implementing a comprehensive set of vdisk (LUN) commands issued througha user interface by a system administrator. These vdisk commands areconverted to primitive file system operations (“primitives”) thatinteract with the file system 665 and the SCSI target module 660 toimplement the vdisks.

The SCSI target module 660, in turn, initiates emulation of a disk orLUN by providing a mapping procedure that translates logical blockaccess to LUNs specified in access requests into virtual block access tothe special vdisk file types and, for responses to the requests, vdisksinto LUNs. The SCSI target module is illustratively disposed between theFC and iSCSI drivers 630, 628 and the file system 665 to thereby providea translation layer of the virtualization system 655 between the SANblock (LUN) space and the file system space, where LUNs are representedas vdisks. Additionally, in the illustrative embodiment, the SCSI targetmodule 660 interprets a novel received Punch Hole command from ahost-side agent and implements deallocation of blocks, in conjunctionwith the file system 665 and vdisk module 670, that are no longer inuse. As described further below, the novel Punch Hole command permits athinly provisioned data container to reduce the number of blockscurrently allocated by it as the amount of structured storage overlaidonto the data container decreases.

The file system 665 illustratively implements the above-described WAFLfile system having an on-disk format representation that is block-basedusing, e.g., 4 kilobyte (kB) blocks and using inodes to describe thefiles. Broadly stated, all inodes of the file system are organized intothe inode file. A file system (fs) info block specifies the layout ofinformation in the file system and includes an inode of a file thatincludes all other inodes of the file system. Each volume has an fsinfoblock that is preferably stored at a fixed location within, e.g., a RAIDgroup of the file system. The inode of the root fsinfo block maydirectly reference (point to) blocks of the inode file or may referenceindirect blocks of the inode file that, in turn, reference direct blocksof the inode file. Within each direct block of the inode file areembedded inodes, each of which may reference indirect blocks that, inturn, reference data blocks of a file or vdisk.

It should be noted that the software “path” through the storageoperating system layers described above needed to perform data storageaccess for the client request received at the multi-protocol storageappliance may alternatively be implemented in hardware. That is, in analternate embodiment of the invention, a storage access request datapath through the operating system layers (including the virtualizationsystem 655) may be implemented as logic circuitry embodied within afield programmable gate array (FPGA) or an application specificintegrated circuit (ASIC). This type of hardware implementationincreases the performance of the storage service provided by appliance500 in response to a file access or block access request issued by aclient 560. Moreover, in another alternate embodiment of the invention,the processing elements of network and storage adapters 525-528 may beconfigured to offload some or all of the packet processing and storageaccess operations, respectively, from processor 522 to thereby increasethe performance of the storage service provided by the multi-protocolstorage appliance. It is expressly contemplated that the variousprocesses, architectures and procedures described herein can beimplemented in hardware, firmware or software.

C. Reclaiming Unused Space From A Thinly Provisioned Data Container

The present invention is directed to a system and method for reclaimingunused storage space from a thinly provisioned data container. Theinvention enables a thinly provisioned data container stored on astorage system to reduce the number of blocks allocated to it as thestructured storage e.g., a host side file system overlaid onto the datacontainer decreases. In an illustrative embodiment, a host-side agentexecutes on a client of the storage system and determines appropriateblocks that may be reclaimed due to the overlaid structured storage nolonger utilizing them. The agent then generates the novel Punch Holecommand and sends it to the storage system using the conventional datapathway between the client and the storage system. Illustratively, thePunch Hole command is implemented as a vendor-specific SCSI command but,in alternate embodiments, may be implemented using other techniques. Forclients utilizing a non-file system application, such as a databaseapplication, the host-side agent interfaces with the application todetermine appropriate blocks of the data container that may be reclaimeddue to the host-side application no longer utilizing the storage space.The agent then generates and sends the appropriate Punch Hole command tothe storage system.

FIG. 7A is a schematic block diagram of the format of the novel PunchHole command structure 700A in accordance with an embodiment of thepresent invention. As noted, the Punch Hole command is illustrativelyimplemented as a vendor specific SCSI command. However, it should benoted that the Punch Hole command may be implemented in other waysincluding, for example, implementing the command into another protocolspecification. The Punch Hole command structure 700A includes anoperation code field 705, a number of a ranges field 710, a controlfield 715, a first range field 720 that includes a logical block addressfield 725 and a range length field 730 and, in alternate embodiments,additional field 735. The operation code field 705 identifies thecommand as a Punch Hole command. The number of ranges field 710identifies the number of range values included in this command. Thecontrol field 715 is utilized to pass control information to the storagesystem. The first range field 720 includes two sub fields, namely, alogical block address field 725 and a range length field 730. Thelogical block address field 725 identifies the starting point of therange of blocks to be allocated, whereas the range length field 730identifies the number of blocks to be deallocated. In the illustrativeembodiment, there are as many range fields, such as first range field720, as there are identified ranges in the number of ranges field 710.The Punch Hole command 700A identifies one or more ranges of blocks,each starting at the logical block address identified in field 725 andcontinuing on for the number of blocks identified in field 730.

Similarly, FIG. 7B is a schematic block diagram of the format of thePunch Hole command structure 700B in accordance with an alternateembodiment of the present invention. The Punch Hole command structure700B includes an operation code field 705, a bitmap size field 740, acontrol field 715, a logical block address field 745, a bitmap field 750and, in alternate embodiments, additional field 735. The operation codefield 705 identifies the command as a Punch Hole command. The bitmapsize field 740 identifies the size of the bitmap contained in bitmapfield 750. The control field 715 is utilized to pass control informationto the storage system. The logical block address field 745 identifies astarting block address. The bitmap field 750 contains a bitmap whereineach bit represents a single block. In this alternate embodiment, thestorage system determines which block to deallocate by adding the offsetof the bit in the bitmap to the logical block address contained in thecommand. If the bit is set, the corresponding block is de-allocated. Asnoted above, these illustrative command structures 700A,B are exemplaryonly. The novel Punch Hole command may be implemented using otherstructures as will be appreciated by one skilled in the art.

FIG. 8 is a flowchart detailing the steps of a procedure 800 forreclaiming unused space from a thinly provisioned data container inaccordance with an embodiment of the present invention. The datacontainer is illustratively described herein as a logical unit number(LUN); however, it should be noted that any suitable data container maybe utilized in accordance with the principles of the present invention.As such, the term LUN should not be taken to be limiting and anysuitable data container may be utilized. The procedure 800 begins instep 805 and continues to step 810 where the agent executing on a clientof the storage system determines that blocks are no longer in use on theLUN. This may occur by, for example, the host-side agent querying thefile system or by examining file system metadata to determine blocksthat have been freed within the file system. Alternately, in embodimentswhere the host-side agent is executing on a client utilizing a non-filesystem application, the agent may determine that blocks are no longer inuse on the LUN by querying the application and/or analyzing itsstructured storage metadata.

Upon identifying a number of blocks that are no longer in use on theLUNs, the agent generates and sends a novel Punch Hole command directedto the LUN (step 815). The generated Punch Hole command identifies theappropriate ranges of blocks to be freed. The Punch Hole command istypically sent via the conventional data pathway between the client andthe storage system. For example, if the client normally communicatesusing FCP with the storage system, the agent will generate a Punch Holecommand and send it using the FCP protocol. In response, the storagesystem releases the identified ranges of a blocks in the LUN anddeallocates the underlying blocks to be reused by the storage system.These blocks are typically deallocated by updating appropriate filesystem metadata to show that they may be re-used by the file system.Additionally, any pointers to the blocks, such as pointers in high levelindirect blocks are cleared. In step 825, the storage system replieswith a response message either acknowledging that the command wassuccessful or with an appropriate error code. The procedure thencompletes in step 830.

In an alternate embodiment, the agent is more proactive regarding theidentification of blocks that may be freed. FIG. 9 is a flowchartdetailing the steps of a procedure 900 for reclaiming unused space froma thinly provisioned data container in accordance with an alternateembodiment of the invention. The procedure 900 begins in step 905continues to step 910 where the agent allocates a file on the host-sidefile system. This may be accomplished using conventional file systemoperation commands to generate a file of a predetermined size. In step915, the agent locks the allocated file so that no operations may bedirected to it. This lock may be generated using conventional host-sidefile system commands. In step 920, the agent determines which datacontainer blocks store the allocated file, by, e.g., using conventionalfile system operations to determine the location within the file systemof a particular file. In step 925, the agent prepares and sends a PunchHole command to the storage system identifying the ranges of blocks inwhich the allocated file resides. The agent then frees the allocatedfile in step 930 before the procedure completes in step 935. By freeingthe allocated file, the host-side file system updates the appropriatepointers to indicate that the blocks previously utilized by the file areno longer in use. Similarly, as result of the Punch Hole command beingprocessed by the storage system, the underlying blocks of the datacontainer of the storage system are also freed and may be reutilized bythe storage system.

To again summarize, the present invention provides a system and methodfor reclaiming unused space in a thinly provisioned data container on astorage system. A host-side agent determines blocks of the structuredstorage of the client that may be de-allocated on the data container by,e.g., querying the host-side file system or by creating a file anddetermining the blocks storing the created file. The agent thengenerates a novel Punch Hole command identifying the blocks to bede-allocated on the data container and sends the Punch Hole command tothe storage system serving the data container. In response to receivingthe Punch Hole command, the storage system deallocates the identifiedblocks (or ranges of blocks) on the data container so that the datacontainer consumes less storage space, thereby enabling the container todynamically grow and shrink in accordance with the amount of data beingstored thereon.

The foregoing description has been directed to specific embodiments ofthis invention. It will be apparent, however, that other variations andmodifications may be made to the described embodiments, with theattainment of some or all of their advantages. For example, it isexpressly contemplated that the teachings of this invention can beimplemented as software, including a computer-readable medium havingprogram instructions executing on a computer, hardware, firmware, or acombination thereof. Additionally, while this description is written interms of a thinly provisioned data container over and underlying filesystem, it should be noted that other thin provisioning implementationsmay be utilized. As such, the use of an underlying file system tosupport a thinly provisioned data container should be taken as exemplaryonly. Accordingly this description is to be taken only by way of exampleand not to otherwise limit the scope of the invention. It is thus theobject of the appended claims to cover all such variations andmodifications as come within the true spirit and scope of the invention.

1. A method for reclaiming unused space from a thinly provisioned datacontainer served by a storage system, the method comprising the stepsof: determining one or more sets of blocks no longer in use on thethinly provisioned data container; sending a punch hole command to thestorage system, the punch hole command identifying one or more sets ofblocks no longer in use on the thinly provisioned data container; and inresponse to receiving the punch hole command, deallocating the one ormore sets of blocks identified in the punch hole command.
 2. The methodof claim 1 wherein the data container comprises a virtual disk.
 3. Themethod of claim 1 wherein the punch hole command comprises a smallcomputer systems interface vendor specific command.
 4. The method ofclaim 1 wherein the punch hole command comprises an operation codefield, a number of ranges field and one or more range identifier fields.5. The method of claim 4 wherein the range identifier fields comprise alogical block address field and a range length field.
 6. The method ofclaim 1 wherein the punch hole command comprises an operation codefield, a bitmap size field, a logical block address field and a bitmapfield.
 7. The method of claim 1 wherein the step of determining one ormore sets of blocks no longer in use on the data container furthercomprises the step of querying a file system on a client.
 8. The methodof claim 1 wherein the step of determining one or more sets of blocks nolonger in use on the data container further comprises the steps of:allocating a file on a file system overlaid onto the data container;locking the allocated file; identifying blocks storing the allocatedfile on the file system; and identifying as the one or more sets ofblocks no longer in use on the data container the identified blocksstoring the allocated file.
 9. The method of claim 1 wherein the step ofdetermining one or more sets of blocks no longer in use on the datacontainer comprises the step of querying a non-file system applicationutilizing the data container.
 10. The method of claim 9 wherein thenon-file system application comprises a database system.
 11. A systemfor reclaiming unused space from a thinly provisioned data containerserved by a storage system, the system comprising: means for determiningone or more sets of blocks no longer in use on the thinly provisioneddata container; means for sending a punch hole command to the storagesystem, the punch hole command identifying one or more sets of blocks nolonger in use on the thinly provisioned data container; and means for inresponse to receiving the punch hole command, deallocating the one ormore sets of blocks identified in the punch hole command.
 12. The systemof claim 11 wherein the data container comprises a virtual disk.
 13. Thesystem of claim 11 wherein the punch hole command comprises a smallcomputer systems interface vendor specific command.
 14. The system ofclaim 11 wherein the punch hole command comprises an operation codefield, a number of ranges field and one or more range identifier fields.15. The system of claim 14 wherein the range identifier fields comprisea logical block address field and a range length field.
 16. The systemof claim 11 wherein the punch hole command comprises an operation codefield, a bitmap size field, a logical block address field and a bitmapfield.
 17. The system of claim 11 wherein the means for determining oneor more sets of blocks no longer in use on the data container furthercomprises means for querying a file system on a client.
 18. The systemof claim 11 wherein the means for determining one or more sets of blocksno longer in use on the data container further comprises: means forallocating a file on a file system overlaid onto the data container;means for locking the allocated file; means for identifying blocksstoring the allocated file on the file system; and means for identifyingas the one or more sets of blocks no longer in use on the data containerthe identified blocks storing the allocated file.
 19. The system ofclaim 11 wherein the means for determining one or more sets of blocks nolonger in use on the data container further comprises means for queryinga non-file system application utilizing the data container.
 20. Thesystem of claim 19 wherein the non-file system application comprises adatabase system.
 21. A system for reclaiming unused space from a thinlyprovisioned data container served by a storage system, the systemcomprising: a host-side agent executing on a client of the storagesystem hosting the thinly provisioned data container, the host-sideagent adapted to determine blocks of the data container that are nolonger in use by the client and to send a punch hole command to thestorage system, wherein the punch hole command identifies the blocks ofthe data container that are no longer in use by the client.
 22. Thesystem of claim 21 wherein the host-side agent is further adapted toquery a file system on the client to determine blocks of the datacontainer that are no longer in use by the client.
 23. The system ofclaim 21 wherein the host-side agent is further adapted to query anon-file system application to determine blocks of the data containerthat are no longer in use by the client.
 24. A computer readable mediumfor reclaiming unused space from a thinly provisioned data containerserved by a storage system, the computer readable medium includingprogram instructions for performing the steps of: determining one ormore sets of blocks no longer in use on the data container; sending apunch hole command to the storage system, the punch hole commandidentifying one or more sets of blocks no longer in use on the datacontainer; and in response to receiving the punch hole command,de-allocating the one or more sets of blocks identified in the punchhole command.
 25. A system for reclaiming unused space from a thinlyprovisioned data container served by a storage system, the systemcomprising: a storage operating system executing on the storage system,the storage operating system adapted to receive a punch hole commandfrom a host-side agent and further adapted to deallocate one or moreranges of blocks identified in the punch hole command.